package com.jtech.together.mvp.presenter;

import android.content.Context;
import android.os.Bundle;

import com.jtech.together.mvp.contract.PhotoGalleryContract;
import com.jtech.together.view.activity.PhotoGalleryActivity;

import java.util.ArrayList;
import java.util.List;

/**
 * 图片浏览
 * Created by wuxubaiyang on 2017/5/11.
 */
public class PhotoGalleryPresenter implements PhotoGalleryContract.Presenter {
    private Context context;
    private PhotoGalleryContract.View view;
    private List<String> photoList;
    private int defaultIndex;

    public PhotoGalleryPresenter(Context context, PhotoGalleryContract.View view, Bundle bundle) {
        this.context = context;
        this.view = view;
        //获取参数
        if (null != bundle) {
            this.photoList = bundle.getStringArrayList(PhotoGalleryActivity.KEY_PHOTO_LIST);
            this.defaultIndex = bundle.getInt(PhotoGalleryActivity.KEY_PHOTO_INDEX, 0);
        }
    }

    @Override
    public List<String> getPhotoList() {
        return null == photoList ? new ArrayList<String>() : photoList;
    }

    @Override
    public int getDefaultIndex() {
        return defaultIndex;
    }
}